﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace MMDemo
{
    public partial class SearchKeyForm : Form
    {
        public SearchKeyForm()
        {
            InitializeComponent();
        }

        private void Okbtn_Click(object sender, EventArgs e)
        {
            try
            {
                string key = this.InputStrtext.Text;
                GlobalSearch.KeyData = Convert.ToInt32(key);
                PublicDataClass.IsInit = true;
                this.Close();
            }
            catch
            {
                MessageBox.Show("输入有误!");
            }
        }

        private void SearchKeyForm_Load(object sender, EventArgs e)
        {
            InputStrtext.Text = GlobalSearch.SearchData[GlobalSearch.SearchData.Length - 1].ToString();
        }
        protected override void WndProc(ref   Message m)
        {
            const int WM_SYSCOMMAND = 0x0112;
            const int SC_CLOSE = 0xF060;
            if (m.Msg == WM_SYSCOMMAND && (int)m.WParam == SC_CLOSE)
            {
                PublicDataClass.IsInit = false;
                this.Close();
                return;
            }
            base.WndProc(ref m);
        }
    }
}
